package com.xingkeduo.service.base.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xingkeduo.dao.TMarketingCardMapper;
import com.xingkeduo.dao.TMarketingCouponBagMapper;
import com.xingkeduo.dao.TMarketingCouponMapper;
import com.xingkeduo.model.param.MarketingParam.MarketingTypeEnum;
import com.xingkeduo.model.po.TMarketing;
import com.xingkeduo.service.base.MarketingService;

@Service
public class MarketingServiceImpl implements MarketingService {
	Logger logger = LoggerFactory.getLogger(MarketingServiceImpl.class);
	@Autowired
	TMarketingCouponBagMapper tMarketingCouponBagMapper;
	@Autowired
	TMarketingCouponMapper tMarketingCouponMapper;
	@Autowired
	TMarketingCardMapper tMarketingCardMapper;

	@Override
	public TMarketing selectMarketingByPrimaryKey(Long marketingId, Integer marketingType) {
		if (marketingType.equals(MarketingTypeEnum.COUPON.getCode())) {
			return tMarketingCouponMapper.selectByPrimaryKey(marketingId);
		} else if (marketingType.equals(MarketingTypeEnum.CARD.getCode())) {
			return tMarketingCardMapper.selectByPrimaryKey(marketingId);
		} else if (marketingType.equals(MarketingTypeEnum.COUPON_BAG.getCode())) {
			return tMarketingCouponBagMapper.selectByPrimaryKey(marketingId);
		}
		return null;
	}
}
